package multithread;

class CubbyHole {
	private int index = 0;
	private int []data = new int[3];
	
	public synchronized void put(int value) {
		while(index == data.length){
			try {
				this.wait();
			} catch(InterruptedException e) {}
		}
		data[index] = value;
		index++;
		this.notify();
	}
	
	public synchronized int get() {
		while(index <=0) {
			try {
				this.wait();
			} catch(InterruptedException e) {}
		}
		index--;
		int val = data[index];
		this.notify();
		return val;
	}

}


public class ProducerConsumerStack {

}
